#pragma once

#include "Client.h"
#include "ClientList.h"

class CDataProc;

struct ClientInfo
{
    uint64_t nId;
    void *pSvr;
    CClient *pClnt;
    CDataProc *pDataProc;

public:
    ClientInfo() {}
    virtual ~ClientInfo();
};

typedef CClientList<ClientInfo, CSpinLock> CClntList;
typedef CClntList::Node ClntNode;

class CClientMgr
{
public:
    CClientMgr();
    ~CClientMgr();

public:
    ClntNode *NewClient(void *pSvr, CClient *pClnt);
    bool DeleteClient(ClntNode *pNode);

    bool IsValidNode(ClntNode *pNode);

private:
    CClntList m_lstClnt;
    CClntList m_lstFree;
    uint64_t m_nIdMax;
};
